# https://git.maximewack.com/maxx/dotfiles/src/commit/c6611e7ef3ab93a712b8e37e784fed1b38fc1174/.config/qutebrowser/config.py

# NOTE: config.py is intended for advanced users who are comfortable
# with manually migrating the config file on qutebrowser upgrades. If
# you prefer, you can also configure qutebrowser using the
# :set/:bind/:config-* commands without having to write a config.py
# file.
#
# Documentation:
#   qute://help/configuring.html
#   qute://help/settings.html

import os

# Still load settings configured via autoconfig.yml
config.load_autoconfig(True)

# Aliases for commands. The keys of the given dictionary are the
# aliases, while the values are the commands they map to.
c.aliases = {
        'q': 'close',
        'qa': 'quit',
        'w': 'session-save',
        'wq': 'quit --save',
        'wqa': 'quit --save'}

# Valid values:
#   - all: Accept all cookies.
#   - no-3rdparty: Accept cookies from the same origin only. This is known to break some sites, such as GMail.
#   - never: Don't accept cookies at all.
config.set(
        'content.cookies.accept',
        'all',
        'chrome-devtools://*')
config.set(
        'content.cookies.accept',
        'all',
        'devtools://*')

# Value to send in the `Accept-Language` header. Note that the value
# read from JavaScript is always the global value.
#config.set(
#        'content.headers.accept_language',
#        '',
#        'https://notabug.org/*')

# User agent to send.  The following placeholders are defined:
# * `{os_info}`: Something like "X11; Linux x86_64".
# * `{webkit_version}`: The underlying WebKit version (set to a fixed value with QtWebEngine).
# * `{qt_key}`: "Qt" for QtWebKit, "QtWebEngine" for QtWebEngine.
# * `{qt_version}`: The underlying Qt version.
# * `{upstream_browser_key}`: "Version" for QtWebKit, "Chrome" for QtWebEngine.
# * `{upstream_browser_version}`: The corresponding Safari/Chrome version.
# * `{qutebrowser_version}`: The currently running qutebrowser version. The default value is equal to the unchanged user agent of QtWebKit/QtWebEngine.
config.set(
        'content.headers.user_agent',
        'Mozilla/5.0 ({os_info}) AppleWebKit/{webkit_version} (KHTML, like Gecko) {upstream_browser_key}/{upstream_browser_version} Safari/{webkit_version}',
        'https://youtube.com/')
config.set(
        'content.headers.user_agent',
        'Mozilla/5.0 ({os_info}; rv:90.0) Gecko/20100101 Firefox/90.0',
        'https://accounts.google.com/*')
config.set(
        'content.headers.user_agent',
        'Mozilla/5.0 ({os_info}) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99 Safari/537.36',
        'https://*.slack.com/*')

# Load images automatically in web pages.
config.set('content.images', True, '*')

# Enable JavaScript.
config.set('content.javascript.enabled', True, 'chrome-devtools://*')
config.set('content.javascript.enabled', True, 'devtools://*')
config.set('content.javascript.enabled', True, 'chrome://*/*')
config.set('content.javascript.enabled', True, 'qute://*/*')

# Allow websites to show notifications.
# Valid values:
#   - true
#   - false
#   - ask
config.set('content.notifications.enabled', True, 'https://www.discord.com/*')
config.set('content.notifications.enabled', True, 'https://www.element.io/*')
config.set('content.notifications.enabled', False, '*')

# content.javascript.can_access_clipboard true

# Page to open if :open -t/-b/-w is used without URL. Use `about:blank` for a blank page.
c.url.default_page = 'https://search.brave.com'
c.url.start_pages = [
        'file://%s/.config/nyxt/home.html' % os.path.expanduser("~"),
        'https://search.brave.com',
        'https://vault.bitwarden.com/#/vault']
